package edu.ucsd.db.bassarisk.algebra.logical;

import edu.ucsd.db.bassarisk.algebra.logical.visitor.LogicalOperatorVisitor;
import edu.ucsd.db.bassarisk.columndef.DataColumnDefinition;
import edu.ucsd.db.bassarisk.query.binding.Bindings.Binding;

public class Scan extends LogicalOperator {
  private final DataColumnDefinition columnScanned;
  private final String filterValue;
  private final Binding bindingSatisfied;

  public Scan(final DataColumnDefinition columnScanned, String filterValue, Binding binding) {
    this.columnScanned = columnScanned;
    this.filterValue = filterValue;
    this.bindingSatisfied = binding;
  }

  public DataColumnDefinition getColumn() {
    return this.columnScanned;
  }
  
  public String filterValue() {
    return this.filterValue;
  }

  public String toString() {
    String format = "Scan[%s, %s]";
    return String.format(format, this.columnScanned, this.bindingSatisfied);
  }

  @Override
  public <R, A> R accept(LogicalOperatorVisitor<R, A> visitor, A arg) {
    return visitor.visitScan(this, arg);
  }

  public DataColumnDefinition getColumnScanned() {
    return columnScanned;
  }

  public Binding getBindingSatisfied() {
    return bindingSatisfied;
  }
}
